package com.demo.task

import android.app.Application
import com.demo.task.ext.chmodExternalFiles
import com.demo.task.ext.defaultLaunch
import com.demo.task.handler.GlobalExceptionHandler
import com.demo.task.manager.UsbSerialPortManager
import com.orhanobut.logger.DiskLogAdapter
import com.orhanobut.logger.Logger
import com.tencent.bugly.crashreport.CrashReport
import com.tencent.mmkv.MMKV
import com.zed.service.APIHelper
import dagger.hilt.android.HiltAndroidApp


@HiltAndroidApp
class MainApplication : Application() {
    companion object {
        lateinit var instance: MainApplication
    }

    override fun onCreate() {
        super.onCreate()
        instance = this
        GlobalExceptionHandler(this)
        CrashReport.initCrashReport(this, "57f63eeaa7", false)
        MMKV.initialize(this)
        APIHelper.init(this)
        UsbSerialPortManager.init(this)
        Logger.addLogAdapter(DiskLogAdapter())
        //setAirPlaneMode(false)
        defaultLaunch()
        chmodExternalFiles()
    }
}
